/**
 * Copyright &copy; 2016-2017 <a href="http://git.oschina.net/whoamien/backend_management">Backend Management</a> All rights reserved.
 */
package com.xw.framework.base.web;

import org.sitemesh.SiteMeshContext;
import org.sitemesh.content.ContentProperty;
import org.sitemesh.content.tagrules.TagRuleBundle;
import org.sitemesh.content.tagrules.html.ExportTagToContentRule;
import org.sitemesh.tagprocessor.State;

/**
 * The Class CustomSiteMeshTagRuleBundle.
 *
 * @author Xi Wei
 */
public class CustomSiteMeshTagRuleBundle implements TagRuleBundle {

	/* (non-Javadoc)
	 * @see org.sitemesh.content.tagrules.TagRuleBundle#install(org.sitemesh.tagprocessor.State, org.sitemesh.content.ContentProperty, org.sitemesh.SiteMeshContext)
	 */
	@Override
	public void install(State defaultState, ContentProperty contentProperty,
			              SiteMeshContext siteMeshContext) {

		defaultState.addRule("menu", new ExportTagToContentRule(siteMeshContext, contentProperty.getChild("menu"), false));
		defaultState.addRule("submenu", new ExportTagToContentRule(siteMeshContext, contentProperty.getChild("submenu"), false));
		defaultState.addRule("codemenuactive", new ExportTagToContentRule(siteMeshContext, contentProperty.getChild("codemenuactive"), false));
		defaultState.addRule("salespromotionmenuactive", new ExportTagToContentRule(siteMeshContext, contentProperty.getChild("salespromotionmenuactive"), false));
	}

	/* (non-Javadoc)
	 * @see org.sitemesh.content.tagrules.TagRuleBundle#cleanUp(org.sitemesh.tagprocessor.State, org.sitemesh.content.ContentProperty, org.sitemesh.SiteMeshContext)
	 */
	@Override
	public void cleanUp(State defaultState, ContentProperty contentProperty,
	             SiteMeshContext siteMeshContext) {
	     }


}
